#include<iostream>
#include<memory>
//弱指针作用：解决共享指针循环引用问题
class Boy;
class Girl
{
public:
    Girl(){}
    Girl(){}
    void SetBoyFriend(std::shared_ptr<Boy>&Boy)
    {
        this->Boyfriend=Boy;
    }

private:
    std::weak_ptr<Boy>=Boyfriend;
    
}

class Boy
{
public:
    Boy(){}
    ~Boy(){}
    void SetGirFriend(std::shared_ptr<Girl>&girl)
    {
        this->girlfriend=girl;
    }

private:
    std::shared_ptr<Girl>=girfriend;
    
}
int main()
{
    std::shared_ptr<Boy> b=std::make_shared<Boy>;
    std::shared_ptr<Girl> g=std::make_shared<Girl>;
    b->SetGirFriend(g);
    g->SetBoyFriend(b);

    //类的里面要么放独占指针，要么放弱指针，不要放共享指针
    return 0;


}